package com.person.mengshuai.mytestdemo.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * nacos测试类
 *
 * @author 孟帅
 * @since 2024/7/29
 */
@RestController
@RequestMapping("/nacos")
@RefreshScope
public class NacosController {
    public static final String AA = "aa";
    public static final String BB = "aa";

    private String cc = "aa";
    private String dd = "aa";

    public static Map<String, String> map = new HashMap<>();

    static {
        map.put("aa", "bb");
        map.put("cc", "dd");
    }

    @Value("${common}")
    private String common;

    @Value("${custom}")
    private String custom;

    @GetMapping("/getCommon")
    public String getCommon() {
        return common;
    }

    @GetMapping("/getCustom")
    public String getCustom() {
        return custom+"cc";
    }

    public static void test(String aa, String bb) {
        System.out.println(aa);
        System.out.println(bb);
    }

    private void bb() {
        System.out.println("bb");
    }
}
